home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compendium Deluxe 2
/
LSD and 17bit Compendium Deluxe - Volume II.iso
/
a
/
prog
/
asmsrc
/
spritemove.lha
/
Sprite.S
Wrap
Text File
|
1989-03-06
|
4KB
|
182 lines
; *** Sprite Mover ***
; (C)1988 by Brian Postma
; J.v.Hartenstraat 51
; 7576 VX Oldenzaal (NL)
; Tel:05410-14763
execbase = 4 ; Exec Offsets
waitport = -384
permit = -138
forbid = -132
openlibrary = -408
closelibrary = -414
openscreen = -198 ; Intuition Offsets
closescreen = -66
openwindow = -204
closewindow = -72
drawimage = -114
move = -240 ; Graphics Offsets
draw = -246
rectfill = -306
loadrbg4 = -192
movesprite = -426
freesprite = -414
output = -60 ; Dos Offsets
write = -48
start:
bsr openstuff
bsr action
bsr closestuff
rts
openstuff:
move.l execbase,a6
lea intname,a1
jsr openlibrary(a6)
move.l d0,intbase
lea gfxname,a1
jsr openlibrary(a6)
move.l d0,gfxbase
move.l intbase,a6
lea osargs,a0
jsr openscreen(a6)
move.l d0,screenbase
add.l #44,d0 ; Screenbase+44 is Viewport
move.l d0,viewport
add.l #40,d0 ; Screenbase+84 is Rastport
move.l d0,rastport
rts
closestuff:
move.l gfxbase,a6
move.l #1,d0
jsr freesprite(a6)
move.l intbase,a6
move.l screenbase,a0
jsr closescreen(a6)
move.l execbase,a6
move.l gfxbase,a1
jsr closelibrary(a6)
move.l intbase,a1
jsr closelibrary(a6)
rts
action:
move.l gfxbase,a6
move.l viewport,a0
lea colors,a1 ; Pointer op KleurData
move.l #32,d0 ; Aantal Kleuren
jsr loadrbg4(a6) ; Zet nieuwe kleuren
moveit:
move.l gfxbase,a6
move.l x,d0
move.l y,d1
lea simplesprite,a1
move.l viewport,a0
jsr movesprite(a6)
bsr joystick
move.l #1000,d0
delay:
btst #6,$bfe001
beq skip2
dbra d0,delay
add.l d6,x
add.l d7,y
bra moveit
skip2:
rts
joystick:
clr.l d6
clr.l d7
clr.w $dff036
move.b $dff00d,d1
move.b d1,d2
lsr.b #1,d2
eor.b d1,d2
btst #0,d2
beq notdown
cmp.l #240,y
beq notdown
move.l #1,d7
notdown:
btst #1,$dff00d
beq notright
cmp.l #304,x
beq notright
move.l #1,d6
notright:
move.b $dff00c,d1
move.b d1,d2
lsr.b #1,d2
eor.b d1,d2
btst #0,d2
beq notup
cmp.l #16,y
beq notup
move.l #-1,d7
notup:
btst #1,$dff00c
beq notleft
cmp.l #0,x
beq notleft
move.l #-1,d6
notleft:
rts
titel: dc.b "Brian Postma",0
intname: dc.b "intuition.library",0
gfxname: dc.b "graphics.library",0
even
x: dc.l 150
y: dc.l 50
screenbase: dc.l 0
rastport: dc.l 0
viewport: dc.l 0
intbase: dc.l 0
gfxbase: dc.l 0
osargs:
dc.w 0,0 ; X,Y Offset
dc.w 320,256 ; Breedte,hooghte
dc.w 2 ; Diepte (Aantal Planes)
dc.b 0,1 ; DetailPen,Blockpen
dc.w 2 ; Viewmode
dc.w 15 ; Screentyp (15=CustomScreen)
dc.l 0 ; Font
dc.l titel ; Titel
dc.l 0,0 ; Gadgets,Bitmap
colors:
dc.w 0,$0fff,0,0,0,0,0,0,0,0,0,0,0,0,0,0
dc.w $0000,$007f,$0038,$0014,0,0,0,0,0,0,0,0,0,0,0,0
simplesprite:
dc.l data ; Pointer op SpriteData
dc.w 16 ; Hoogte
dc.w 0,0 ; X,Y Pos
dc.w 1 ; Sprite Nummer (0-7)
data:
dc.w 0,0 ; Altijd met 0,0 beginnen
dc.w %1111111111111111,%0000000000000001
dc.w %1100000000000011,%0011111111111111
dc.w %1100000000000011,%0011111111111111
dc.w %1100000000000011,%0011111111111111
dc.w %1100000000000011,%0011111111111111
dc.w %1100000000000011,%0011111111111111
dc.w %1100000000000011,%0011111111111111
dc.w %1100000000000011,%0011111111111111
dc.w %1100000000000011,%0011111111111111
dc.w %1100000000000011,%0011111111111111
dc.w %1100000000000011,%0011111111111111
dc.w %1100000000000011,%0011111111111111
dc.w %1100000000000011,%0011111111111111
dc.w %1100000000000011,%0011111111111111
dc.w %1100000000000011,%0011111111111111
dc.w %1111111111111111,%0111111111111111
dc.w 0,0 ; En eindigen